// Bristleback plugin - Copyright (c) 2010 bristleback.googlecode.com
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
// This library is distributed in the hope that it will be useful,
// but without any warranty; without even the implied warranty of merchantability
// or fitness for a particular purpose.
// You should have received a copy of the GNU Lesser General Public License along
// with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
// ---------------------------------------------------------------------------
package pl.bristleback.server.bristle.states;

/**
 * Classes implementing this interface perform operations required to start or shutdown server properly.
 * Listeners are not designed to operate on jwebsocket classes.
 * <p/>
 * <p/>
 * Created on: 2010-10-14 18:10:54 <br/>
 *
 * @author Wojciech Niemiec
 */
public interface ServerStateListener {

  /**
   * Operations that should be performed at server start.
   * Those operations cannot be related with any websocket operations, like sending messages.
   *
   * @param listenerChain listener chain.
   *                      If needed, server state listener can stop processing next listeners by invoking
   *                      {@link pl.bristleback.server.bristle.states.ServerStateListenerChain#cancelChain()} method.
   */
  void onServerStart(ServerStateListenerChain listenerChain);

  /**
   * Operations that should be performed at server stop.
   *
   * @param listenerChain listener chain.
   *                      If needed, server state listener can stop processing next listeners by invoking
   *                      {@link pl.bristleback.server.bristle.states.ServerStateListenerChain#cancelChain()} method.
   */
  void onServerStop(ServerStateListenerChain listenerChain);
}
